<%@ Page Title="New Lend" Language="C#" MasterPageFile="~/Pages/user/userMaster.Master" AutoEventWireup="true" CodeBehind="NewLend.aspx.cs" Inherits="WarehouseWebAPP.Pages.user.NewLend" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table class="style1">
        <tr>
            <td>
               
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:DetailsView ID="NewLendDetailsView" runat="server" 
                    AutoGenerateRows="False" CellPadding="4" DataKeyNames="lend_num" 
                    DataSourceID="NewLendObjectDataSource" 
    DefaultMode="Insert" ForeColor="#333333" 
                    GridLines="None" Height="50px" Width="338px" 
                            oniteminserting="NewLendDetailsView_ItemInserting">
                                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                    <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
                                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                    <Fields>
                                        <asp:BoundField DataField="lend_num" HeaderText="lend_num" ReadOnly="True" 
                            SortExpression="lend_num" Visible="False" />
                                        <asp:TemplateField HeaderText="User" SortExpression="lend_user">
                                            <EditItemTemplate>
                                                <input ID="NewLendDetailsView_TextBox2" name="NewLendDetailsView$TextBox2" 
                                    type="text" value="Databound" />
                                            </EditItemTemplate>
                                            <InsertItemTemplate>
                                                <cc1:ComboBox ID="ComboBox1" runat="server" AppendDataBoundItems="True" 
                                    AutoCompleteMode="Append" DataSourceID="UserObjectDataSource" 
                                    DataTextField="user_name" DataValueField="user_num" 
                                    DropDownStyle="DropDownList" MaxLength="0" 
                                    SelectedValue='<%# Bind("lend_user") %>' style="display: inline;">
                                                </cc1:ComboBox>
                                                <asp:ObjectDataSource ID="UserObjectDataSource" runat="server" 
                                    SelectMethod="userGet" TypeName="WarehouseWebAPP.code.BLL.UserBLL"></asp:ObjectDataSource>
                                            </InsertItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label1" runat="server" Text='<%# Bind("lend_user") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Customer" SortExpression="lend_customer">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("lend_customer") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <InsertItemTemplate>
                                                <cc1:ComboBox ID="ComboBox2" runat="server" AppendDataBoundItems="True" 
                                    AutoCompleteMode="Append" DataSourceID="CustomerObjectDataSource" 
                                    DataTextField="customer_name" DataValueField="customer_num" 
                                    DropDownStyle="DropDownList" MaxLength="0" 
                                    SelectedValue='<%# Bind("lend_customer") %>' style="display: inline;">
                                                </cc1:ComboBox>
                                                <asp:ObjectDataSource ID="CustomerObjectDataSource" runat="server" 
                                    SelectMethod="CustomerGet" TypeName="WarehouseWebAPP.code.BLL.CustomerBLL">
                                                </asp:ObjectDataSource>
                                            </InsertItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label2" runat="server" Text='<%# Bind("lend_customer") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Item" SortExpression="lend_item_num">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("lend_item_num") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <InsertItemTemplate>
                                                <cc1:ComboBox ID="ComboBox4" runat="server" AppendDataBoundItems="True" 
                                    AutoCompleteMode="Append" DataSourceID="ItemObjectDataSource" 
                                    DataTextField="lend_item_serial" DataValueField="lend_item_num" 
                                    DropDownStyle="DropDownList" MaxLength="0" style="display: inline;" 
                                    SelectedValue='<%# Bind("lend_item_num") %>'>
                                                </cc1:ComboBox>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                                    ControlToValidate="ComboBox4" ErrorMessage="*"></asp:RequiredFieldValidator>
                                                <asp:ObjectDataSource ID="ItemObjectDataSource" runat="server" 
                                    SelectMethod="LendItemGetAvailable" 
                                    TypeName="WarehouseWebAPP.code.BLL.LendItemBLL" 
                                    OldValuesParameterFormatString="original_{0}"></asp:ObjectDataSource>
                                            </InsertItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label3" runat="server" Text='<%# Bind("lend_item_num") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Start Date" SortExpression="lend_start_date">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("lend_start_date") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <InsertItemTemplate>
                                                <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("lend_start_date") %>'></asp:TextBox>
                                                <cc1:CalendarExtender ID="TextBox4_CalendarExtender" runat="server" 
                                                    Format="dd/MM/yyyy" TargetControlID="TextBox4">
                                                </cc1:CalendarExtender>
                                                <cc1:MaskedEditExtender ID="TextBox4_MaskedEditExtender" runat="server" 
                                                    Mask="99/99/9999" MaskType="Date" 
                                            TargetControlID="TextBox4">
                                                </cc1:MaskedEditExtender>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                                    ControlToValidate="TextBox4" ErrorMessage="*"></asp:RequiredFieldValidator>
                                            </InsertItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label4" runat="server" Text='<%# Bind("lend_start_date") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="End Date" SortExpression="lend_end_date">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("lend_end_date") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <InsertItemTemplate>
                                                <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("lend_end_date") %>'></asp:TextBox>
                                                <cc1:MaskedEditExtender ID="TextBox5_MaskedEditExtender" runat="server" 
                                            TargetControlID="TextBox5" Mask="99/99/9999" MaskType="Date" 
                                            UserDateFormat="DayMonthYear">
                                                </cc1:MaskedEditExtender>
                                                <cc1:CalendarExtender ID="TextBox5_CalendarExtender" runat="server" 
                                    Format="dd/MM/yyyy" TargetControlID="TextBox5">
                                                </cc1:CalendarExtender>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                    ControlToValidate="TextBox5" ErrorMessage="*"></asp:RequiredFieldValidator>
                                            </InsertItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label5" runat="server" Text='<%# Bind("lend_end_date") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Returned Date" 
                            SortExpression="lend_returned_date" Visible="False">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox6" runat="server" 
                                    Text='<%# Bind("lend_returned_date") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <InsertItemTemplate>
                                                <asp:TextBox ID="TextBox6" runat="server" 
                                    Text='<%# Bind("lend_returned_date") %>' Visible="False"></asp:TextBox>
                                            </InsertItemTemplate>
                                            <ItemTemplate>
                                                <asp:Label ID="Label6" runat="server" Text='<%# Bind("lend_returned_date") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:CommandField ShowInsertButton="True" />
                                    </Fields>
                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <EditRowStyle BackColor="#999999" />
                                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                </asp:DetailsView>
                                <asp:ObjectDataSource ID="NewLendObjectDataSource" runat="server" 
                                    InsertMethod="LendInsert" SelectMethod="LendStartAfteToday" 
                                    TypeName="WarehouseWebAPP.code.BLL.LendBLL">
                                    <InsertParameters>
                                        <asp:Parameter DbType="Guid" Name="lend_user" />
                                        <asp:Parameter DbType="Guid" Name="lend_customer" />
                                        <asp:Parameter DbType="Guid" Name="lend_item_num" />
                                        <asp:Parameter Name="lend_start_date" Type="DateTime" />
                                        <asp:Parameter Name="lend_end_date" Type="DateTime" />
                                        <asp:Parameter Name="lend_returned_date" Type="DateTime" />
                                    </InsertParameters>
                                </asp:ObjectDataSource>
                            </ContentTemplate>
                        </asp:UpdatePanel>
            </td>
        </tr>
    </table>
</asp:Content>
